<?php
	if($this->session->userdata('userType'))
	{
		switch($user =strtolower($this->session->userdata('userType')))
		{
			case $user == 'admin':
				$this->load->view('layouts/_admin_menu');
			break;
			case $user == 'cashier':
				$this->load->view('layouts/_cashier_menu');
			break;
			case $user == 'evaluation':
				$this->load->view('layouts/_evaluation_menu');
			break;
			case $user == 'finance':
				$this->load->view('layouts/_finance_menu');
			break;
			case $user == 'hrd':
				$this->load->view('layouts/_hrd_menu');
			break;
			case $user == 'president':
				$this->load->view('layouts/_president_menu');
			break;
			case $user == 'registrar':
				$this->load->view('layouts/_registrar_menu');
			break;
			case $user == 'teacher':
				$this->load->view('layouts/_teacher_menu');
			break;
			case $user == 'librarian':
				$this->load->view('layouts/_librarian_menu');
			break;
			case $user == 'custodian':
				$this->load->view('layouts/_custodian_menu');
			break;
			case $user == 'guidance':
				$this->load->view('layouts/_guidance_menu');
			break;
			case $user == 'department-head':
				$this->load->view('layouts/_dephead_menu');
			break;
			case $user == 'vice_principal':
				$this->load->view('layouts/_vice_principal_menu');
			break;
			case $user == 'encoder':
				$this->load->view('layouts/_encoder_menu');
			break;
			case $user == 'student':
			case $user == FALSE:
			case $user == NULL:
				return NULL;
			break;
		}
	}
?>


<script>
	/*script for hiding the div*/
	$(document).ready(function(){

	    if ( Modernizr.touch )
	    {
	        
	    }else{
	        //class for saving menu cookies
	        var menu = {
	            setCookie : function(key, value) {
	                var expires = new Date();
	                expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
	                document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
	            },
	            getCookie : function(key) {
	                var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
	                return keyValue ? keyValue[2] : null;
	            }
	        }

	        // get current cookie
	        var cookie = menu.getCookie('varlochidsow');

	        //initialize menu
	        var init_menu = function(){
	            //if cookie is existing
	            if(cookie == 'hide'){
	            	$('a#hider').text('Show Sidebar');
	            	$("div.hidediv").hide();
	                $('div#content-views').removeClass('large-9').addClass('large-12');
	            }else{
	                //no saved cookie do not slide up the active
	                $("div.hidediv").show();
	                $('div#content-views').removeClass('large-12').addClass('large-9');
	            }
	        }

	        // initialize the hide up on page load
	        var dpc = setInterval(init_menu(), 1);
	        //break the set interval
	        clearInterval(dpc);
	    
			$('a#hider').on('click',function(e){
				e.preventDefault();
				
				menu.setCookie('varlochidsow','');
				
				$("div.hidediv").toggle({
					complete:function(){
						if($("div.hidediv").is(":visible") )
						{
							$('a#hider').text('Hide Sidebar');
							menu.setCookie('varlochidsow','nohide');
							$('div#content-views').removeClass('large-12').addClass('large-9');
						}else{
							$('a#hider').text('Show Sidebar');
							menu.setCookie('varlochidsow','hide');
							$('div#content-views').removeClass('large-9').addClass('large-12');
						}
					},
				});
			});
		}
	});
</script>